
class Album

  attr_accessor :name, :artist
  attr_reader :tracks
  
  @@all = []
  
  def self.all
    return @@all
  end
  
  def <=>(other)
     self.name.downcase <=> other.name.downcase
  end
    

  def initialize(artist,name)
    @name = name
    @artist = artist
    @tracks = [] 
    
    return if (name == "Unknown Album")
    
    @@all.each do |a|
      if( a.name == name )
        return;
      end
    end
    @@all << self
  end
  
  def self.album(name)
    @@all.each do |a|
      if( a.name.downcase == name.downcase )
        return a;
      end
    end
    return nil
  end

  def addTrack(track)
    @tracks << track if !@tracks.include?(track);
  end



end